package com.xyc.student.mapper;

import com.xyc.student.pojo.Associate;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AssociateMapper {
    @Select("select * from associate")
    List<Associate> find();

    @Select("select * from associate where tea_id = #{tea_id}")
    List<Associate> findById(Integer tea_id);

    @Update("update associate set tea_id = 1 where stu_id = #{stu_id}")
    void updateYes(Integer id);

    @Update("update associate set tea_id = 0 where stu_id = #{stu_id}")
    void updateNo(Integer stu_id);

    @Update("update associate set name = #{name} where stu_id = #{id}")
    void updateName(String name, Integer id);

    @Insert("insert into associate values(#{name},#{id},0)")
    void add(String name, Integer id);

    @Delete(("delete from associate where stu_id = #{id}"))
    void del(Integer id);
}
